home *** CD-ROM | disk | FTP | other *** search
- /*----- ARCHIVE xtoi.c -----------------------------------------------------*/
- /*
- ** xtoi -- convert hex string to integer nbr
- ** returns field size, else ERR on return
- */
- #define ERR -2
- xtoi(hexstr,nbr) char *hexstr; int *nbr; {
- int d,t; d=0;
- *nbr=0;
- while (1)
- {
- if ((*hexstr>='0')&(*hexstr<='9')) t=48;
- else if((*hexstr>='A')&(*hexstr<='F')) t=55;
- else if((*hexstr>='a')&(*hexstr<='f')) t=87;
- else break;
- if (d<4) ++d; else return ERR;
- *nbr=*nbr<<4;
- *nbr=*nbr+(*hexstr++)-t;
- }
- return d;
- }
- (c,stdout); continue;}
- if (*ctl=='%') {cout(*ctl++,stdout); continue;}
- cx=ctl;
- if (*cx=='-') {rig